//
//  THJFabuDianjiaVC.m
//  THJXHW
//
//  Created by 河南德艺 on 2018/10/11.
//  Copyright © 2018年 河南德艺. All rights reserved.
//

#import "THJFabuDianjiaVC.h"
#import "LMJDropdownMenu.h"
#import "THJDJSelectView.h"
#import "THJDIanjiaXieYiVC.h"
#import "THJFabuXieyiVC.h"

@interface THJFabuDianjiaVC ()<LMJDropdownMenuDelegate,THJDJSelectViewDelegate,THJFabuXieyiVCDelegate>
{
    NSInteger maiFlag;
    NSMutableArray * areaArr;
    NSString * type;
    NSString * areaId;
    NSString * sheng;
    LMJDropdownMenu * dropdownMenu;
    BOOL accept;
}
@property (weak, nonatomic) IBOutlet UIButton *btn1;
@property (weak, nonatomic) IBOutlet UIButton *btn2;
@property (strong,nonatomic) THJDJSelectView * selectView;
@property (weak, nonatomic) IBOutlet UIButton *areaBtn;
@property (weak, nonatomic) IBOutlet UITextField *tf1;
@property (weak, nonatomic) IBOutlet UITextField *tf2;
@property (weak, nonatomic) IBOutlet UIButton *acceptBtn;
@property (weak, nonatomic) IBOutlet UIButton *heyueBtn;
@property (weak, nonatomic) IBOutlet UIButton *ggBtn;
@property (weak, nonatomic) IBOutlet UIButton *cangkuBtn;
@property (weak, nonatomic) IBOutlet UIButton *productBtn;
@property (weak, nonatomic) IBOutlet UIButton *stsBtn1;
@property (weak, nonatomic) IBOutlet UIButton *stsBtn2;
@property (weak, nonatomic) IBOutlet UITextField *stsipt;
@property (weak, nonatomic) IBOutlet UILabel *ststextLabel1;
@property (weak, nonatomic) IBOutlet UILabel *ststextLabel2;
@property (weak, nonatomic) IBOutlet UILabel *ststextLabel3;

@property (weak, nonatomic) IBOutlet UILabel *gongsiLabel;
@property (weak, nonatomic) IBOutlet UILabel *stsLabel;
@property (weak, nonatomic) IBOutlet UIButton *ckAddressLabel;

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *contactLabel;
@property (weak, nonatomic) IBOutlet UITextField *contactInput;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UITextField *phoneInput;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contactLabelDistance;
@property (weak, nonatomic) IBOutlet UIView *line1;
@property (weak, nonatomic) IBOutlet UIView *line2;
@property (weak, nonatomic) IBOutlet UIButton *stsbtn3;


@property (nonatomic,copy)NSString * heyueType;
@property (nonatomic,copy)NSString * guigeType;
@property (nonatomic,copy)NSString * areaType;
@property (nonatomic,copy)NSString * cangkuID;
@property (nonatomic,copy)NSString * gongsiName;
@property (nonatomic,copy)NSString * dunshu;
@property (nonatomic,copy)NSString * price;
@property (nonatomic,copy)NSString * contact;
@property (nonatomic,copy)NSString * phone;
@property (nonatomic,copy)NSString * stsFlag;
@end

@implementation THJFabuDianjiaVC
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
    [self setStateBarColor:COLOR(83, 84, 85, 1)];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self btn1Action:@"1"];
    self.stsFlag = @"";
    maiFlag = 1;
    accept = NO;
    if([self.fromFlag isEqual:@"edit"]){
        [self setXNavBarWithTitle:@"编辑产品"];
    }else{
        [self setXNavBarWithTitle:@"发布点价产品"];
    }
        
    [self.tf1 addTarget:self action:@selector(tf1changed:) forControlEvents:UIControlEventEditingChanged];
    [self.tf2 addTarget:self action:@selector(tf2changed:) forControlEvents:UIControlEventEditingChanged];
    [self.stsipt addTarget:self action:@selector(stschanged:) forControlEvents:UIControlEventEditingChanged];
    [self.contactInput addTarget:self action:@selector(contactchanged:) forControlEvents:UIControlEventEditingChanged];
    [self.phoneInput addTarget:self action:@selector(phonechanged:) forControlEvents:UIControlEventEditingChanged];
    self.stsipt.keyboardType = UIKeyboardTypeDecimalPad;
//    dropdownMenu = [[LMJDropdownMenu alloc] init];
//    [dropdownMenu setFrame:CGRectMake(69.5, 95, 100, 30)];
//    dropdownMenu.backgroundColor = SingleColor(redColor);
//    [dropdownMenu setMenuTitles:@[@"硅铁72",@"硅锰6517"] rowHeight:40];
////    dropdownMenu.mainBtn.titleLabel.font = [UIFont systemFontOfSize:17];
//    dropdownMenu.delegate = self;
//    [self.view addSubview:dropdownMenu];
    
//    [dropdownMenu.mainBtn setTitle:@"硅锰651798" forState:UIControlStateNormal];
    if([self.fromFlag isEqual:@"edit"]){
        self.productBtn.enabled = NO;
        self.heyueBtn.enabled  = NO;
        self.ggBtn.enabled = NO;
        self.btn1.enabled = self.btn2.enabled =  NO;
        self.areaBtn.enabled = NO;
        self.cangkuBtn.enabled = NO;
        
        [self getItemInfo];
        if([self.act isEqual:@"buy"]){
            [self btn2Action:@"1"];
            maiFlag = 1;
            [self.btn1 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
            [self.btn2 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
        }else{
            [self btn1Action:@"1"];
            maiFlag = 0;
            [self.btn1 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
            [self.btn2 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
        }
    }
    
//    [self performSelector:@selector(yanshouBianzhunBtn:) withObject:nil afterDelay:1];
}
-(THJDJSelectView*)selectView{
    if(!_selectView){
        _selectView = [[THJDJSelectView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
        _selectView.delegate = self;
    }
    return _selectView;
}

- (void)tf1changed:(UITextField *)textField{
    NSLog(@"textfield text %@",textField.text);
    self.gongsiName = textField.text;
}
- (void)tf2changed:(UITextField *)textField{
    NSLog(@"textfield text %@",textField.text);
    self.dunshu = textField.text;
}
- (void)stschanged:(UITextField *)textField{
    NSLog(@"textfield text %@",textField.text);
    
    self.price = textField.text;
}
- (void)contactchanged:(UITextField *)textField{
    NSLog(@"textfield text %@",textField.text);
    self.contact = textField.text;
}
- (void)phonechanged:(UITextField *)textField{
    NSLog(@"textfield text %@",textField.text);
    
    self.phone = textField.text;
}
- (IBAction)productBtnAction:(id)sender {
    NSString * urlStr = @"https://dianjia.thjb.net/dingjia.php";
    [THJNetWork getNetDataWithTokenFromUrl:urlStr callback:^(NSDictionary * receiveData, NSError *error) {
        NSLog(@"产品列表--%@",receiveData);
        if([receiveData[@"status"] isEqual:@"200"]){
            
            self.selectView.dataArr = receiveData[@"data"];
            self.selectView.listKey = @"name";
            self.selectView.type = @"product";
            [self.selectView.tableview reloadData];
            UIWindow * window = [UIApplication sharedApplication].keyWindow;
            [window addSubview:self.selectView];
        }
    }];
}
- (IBAction)btn1Action:(id)sender {
   
    maiFlag = 1;
    [self.btn1 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
    [self.btn2 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    self.contactLabel.hidden = YES;
    self.contactInput.hidden = YES;
    self.phoneLabel.hidden = YES;
    self.phoneInput.hidden = YES;
    self.gongsiLabel.text = @"货权公司：";
    self.tf1.placeholder = @"输入货权公司";
    self.stsLabel.hidden = NO;
    self.stsBtn1.hidden = NO;
    self.stsBtn2.hidden = NO;
    self.stsbtn3.hidden = NO;
    self.ststextLabel1.hidden = NO;
    self.ststextLabel2.hidden = NO;
    self.ststextLabel3.hidden = NO;
    self.stsipt.hidden = NO;
    self.line1.hidden = self.line2.hidden = YES;
    
    
}
- (IBAction)btn2Action:(id)sender {
   
     maiFlag = 0;
    [self.btn1 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    [self.btn2 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
    self.stsLabel.hidden = YES;
    self.stsBtn1.hidden = YES;
    self.stsBtn2.hidden = YES;
    self.stsbtn3.hidden = YES;
    self.ststextLabel1.hidden = YES;
    self.ststextLabel2.hidden = YES;
    self.ststextLabel3.hidden = YES;
    self.gongsiLabel.text = @"价格：";
    self.tf1.placeholder = @"填写价格";
    self.stsipt.hidden = YES;
    self.contactLabelDistance.constant = 15;
    self.contactLabel.hidden = NO;
    self.contactInput.hidden = NO;
    self.phoneLabel.hidden = NO;
    self.phoneInput.hidden = NO;
    self.line1.hidden = self.line2.hidden = NO;
}
- (IBAction)stsBtn1Action:(id)sender {
    [self.stsBtn1 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
    [self.stsBtn2 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    [self.stsbtn3 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    self.stsFlag = @"";
}
- (IBAction)stsBtn2Action:(id)sender {
    [self.stsbtn3 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    [self.stsBtn1 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    [self.stsBtn2 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
    self.stsFlag = @"-";
}
- (IBAction)stsBtn3Action:(id)sender {
    [self.stsbtn3 setImage:kGetImage(@"maiSelect") forState:UIControlStateNormal];
    [self.stsBtn1 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    [self.stsBtn2 setImage:kGetImage(@"maiNoSelect") forState:UIControlStateNormal];
    self.price = @"0";
    self.stsipt.text = @"0";
    self.stsipt.enabled = NO;
}


- (IBAction)heyueBtnAction:(id)sender {
    if(!self.typeStr){
        [self HUDShowMsg:@"请先选择产品" AfterDelayDimiss:2];
    }else{
        NSString * urlStr = [NSString stringWithFormat:@"https://dianjia.thjb.net/dingjia.php?f=index&r=index&m=heyue&act=%@_%ld",self.typeStr,maiFlag];
        [THJNetWork getNetDataWithTokenFromUrl:urlStr callback:^(NSDictionary * receiveData, NSError *error) {
            NSLog(@"合约列表--%@",receiveData);
            if([receiveData[@"status"] isEqual:@"200"]){
                self.selectView.type = @"heyue";
                self.selectView.dataArr = receiveData[@"data"];
                self.selectView.listKey = @"name";
                [self.selectView.tableview reloadData];
                UIWindow * window = [UIApplication sharedApplication].keyWindow;
                [window addSubview:self.selectView];
            }
        }];
    }
    
}
- (IBAction)guigeBtnAction:(id)sender {
    if(!self.typeStr){
        [self HUDShowMsg:@"请先选择产品" AfterDelayDimiss:2];
    }else{
        NSLog(@"%@",self.typeStr);
        self.selectView.type = @"heyue";
        if(maiFlag == 1){
            self.selectView.dataArr = @[
            @{
                @"id":@"1",
                @"name":@"10mm-60mm"
            },
            @{
                @"id":@"2",
                @"name":@"10mm-70mm"
            },
            @{
                @"id":@"3",
                @"name":@"10mm-80mm"
            }
            ];
        }else{
            self.selectView.dataArr = @[
                @{
                    @"id":@"0",
                    @"name":@"不限"
                },
                @{
                    @"id":@"1",
                    @"name":@"10mm-60mm"
                },
                @{
                    @"id":@"2",
                    @"name":@"10mm-70mm"
                },
                @{
                    @"id":@"3",
                    @"name":@"10mm-80mm"
                }
            ];
        }
        self.selectView.listKey = @"name";
        self.selectView.type = @"guige";
        [self.selectView.tableview reloadData];
        UIWindow * window = [UIApplication sharedApplication].keyWindow;
        [window addSubview:self.selectView];
    }
}
//仓库选择
- (IBAction)cangkuBtnAtioin:(id)sender {
    if(!self.typeStr){
        [self HUDShowMsg:@"请先选择产品" AfterDelayDimiss:2];
    }else if(!self.areaType){
        [self HUDShowMsg:@"请先选择交割地区" AfterDelayDimiss:2];
    }else{
        NSString * urlStr = [NSString stringWithFormat:@"https://dianjia.thjb.net/dingjia.php?f=index&r=index&m=house&act=%@_%@",self.areaType,self.typeStr];
        [THJNetWork getNetDataWithTokenFromUrl:urlStr callback:^(NSDictionary * receiveData, NSError *error) {
            NSLog(@"仓库列表--%@",receiveData);
            if([receiveData[@"status"] isEqual:@"200"]){
                areaArr = receiveData[@"data"];
                self.selectView.dataArr = receiveData[@"data"];
                self.selectView.type = @"cangku";
                [self.selectView.tableview reloadData];
                UIWindow * window = [UIApplication sharedApplication].keyWindow;
                [window addSubview:self.selectView];
            }
        }];
    }
}
//地区选择
- (IBAction)areaBtnAction:(id)sender {
    if(!self.typeStr){
        [self HUDShowMsg:@"请先选择产品" AfterDelayDimiss:2];
    }else{
        NSString * urlStr = [NSString stringWithFormat:@"https://dianjia.thjb.net/dingjia.php?f=index&r=index&m=arealist&act=%ld",maiFlag];
        [THJNetWork getNetDataWithTokenFromUrl:urlStr callback:^(NSDictionary * receiveData, NSError *error) {
            NSLog(@"地区列表--%@",receiveData);
            if([receiveData[@"status"] isEqual:@"200"]){
                areaArr = receiveData[@"data"];
                self.selectView.dataArr = receiveData[@"data"];
                self.selectView.type = @"area";
                [self.selectView.tableview reloadData];
                UIWindow * window = [UIApplication sharedApplication].keyWindow;
                [window addSubview:self.selectView];
            }
        }];
    }
}
-(void)selectIndex:(NSString*)index Info:(NSDictionary*)info Type:(NSString *)type{
   
    if([type isEqual:@"product"]){
        [self.productBtn setTitle:info[@"name"] forState:UIControlStateNormal];
        self.typeStr = info[@"id"];
    }else if([type isEqual:@"heyue"]){
        [self.heyueBtn setTitle:info[@"name"] forState:UIControlStateNormal];
        self.heyueType = info[@"id"];
    }else if([type isEqual:@"guige"]){
        [self.ggBtn setTitle:info[@"name"] forState:UIControlStateNormal];
        self.guigeType = info[@"id"];
    }else if([type isEqual:@"area"]){
        [self.areaBtn setTitle:info[@"name"] forState:UIControlStateNormal];
        self.areaType = info[@"id"];
    }else if([type isEqual:@"cangku"]){
        [self.cangkuBtn setTitle:info[@"name"] forState:UIControlStateNormal];
        self.cangkuID = info[@"id"];
        NSString * urlStr = [NSString stringWithFormat:@"https://dianjia.thjb.net/dingjia.php?f=index&r=index&m=houseAddress&act=%@",info[@"id"]];
        [THJNetWork getNetDataWithTokenFromUrl:urlStr callback:^(NSDictionary * receiveData, NSError *error) {
            NSLog(@"dizhi列表--%@",receiveData);
            if([receiveData[@"status"] isEqual:@"200"]){
                [self.ckAddressLabel setTitle:receiveData[@"data"] forState:UIControlStateNormal];
            }
        }];
    }
   
}

- (IBAction)sureBtnAction:(id)sender {
    if([self.fromFlag isEqual:@"edit"]){
        if(!self.gongsiName){
            [self HUDShowMsg:@"请填写价格" AfterDelayDimiss:2];
        }else if([self.gongsiName floatValue] < 0){
            [self HUDShowMsg:@"请填写正确价格" AfterDelayDimiss:2];
        }else if(!self.dunshu){
            [self HUDShowMsg:@"请填写吨数" AfterDelayDimiss:2];
        }else if(!self.contact){
            [self HUDShowMsg:@"请填写联系人" AfterDelayDimiss:2];
        }else if(!self.phone){
            [self HUDShowMsg:@"请填写手机号" AfterDelayDimiss:2];
        }else if(self.phone.length != 11){
            [self HUDShowMsg:@"请填写正确手机号" AfterDelayDimiss:2];
        }else if(!accept){
            [self HUDShowMsg:@"同意点价协议才能发布" AfterDelayDimiss:2];
        }else{
            NSString * urlStr = @"https://dianjia.thjb.net/dingjia.php?f=member&r=member&m=productedit";
            NSDictionary * paraDic = @{
                @"act":self.act,
                @"num":self.dunshu,
                @"id":self.itemid,
                @"price":self.gongsiName,
                @"contactname":self.contact,
                @"contactmobile":self.phone,
            };
            NSLog(@"%@",paraDic);
            [THJNetWork postDataFromUrl:urlStr parameters:paraDic Token:[THJTools getToken] callback:^(NSDictionary * receiveData, NSError *error){
                NSLog(@"receivedata:%@",receiveData);
                [self HUDShowMsg:receiveData[@"tip"] AfterDelayDimiss:2];
                [self.navigationController popViewControllerAnimated:YES];
            }];
        }
    }else{
        if(maiFlag == 1){
            if(!self.typeStr){
                [self HUDShowMsg:@"请选择产品名称" AfterDelayDimiss:2];
            }else if(!self.heyueType){
                [self HUDShowMsg:@"请选择合约" AfterDelayDimiss:2];
            }else if(!self.guigeType){
                [self HUDShowMsg:@"请选择规格" AfterDelayDimiss:2];
            }else if(!self.areaType){
                [self HUDShowMsg:@"请选择地区" AfterDelayDimiss:2];
            }else if(!self.cangkuID){
                [self HUDShowMsg:@"请选择仓库" AfterDelayDimiss:2];
            }else if(!self.gongsiName){
                [self HUDShowMsg:@"请填写货权公司" AfterDelayDimiss:2];
            }else if(!self.dunshu){
                [self HUDShowMsg:@"请填写吨数" AfterDelayDimiss:2];
            }else if(!accept){
                [self HUDShowMsg:@"同意点价协议才能发布" AfterDelayDimiss:2];
            }else{
                NSString * urlStr = @"https://dianjia.thjb.net/dingjia.php?f=Member&r=Member&m=add&act=sell";
                NSDictionary * paraDic = @{
                    @"type":self.typeStr,
                    @"num":self.dunshu,
                    @"area":self.areaType,
                    @"price":[NSString stringWithFormat:@"%@%@",self.stsFlag,self.price],
                    @"heyueid":self.heyueType,
                    @"protype":self.guigeType,
                    @"storehouse":self.cangkuID,
                    @"jiaojecompany":self.gongsiName
                };
                NSLog(@"%@",paraDic);
                [THJNetWork postDataFromUrl:urlStr parameters:paraDic Token:[THJTools getToken] callback:^(NSDictionary * receiveData, NSError *error){
                    NSLog(@"receivedata:%@",receiveData);
                    [self HUDShowMsg:receiveData[@"tip"] AfterDelayDimiss:2];
                    [self performSelector:@selector(pop) withObject:nil afterDelay:2.0];
                }];
            }
        }else{
            if(!self.typeStr){
                [self HUDShowMsg:@"请选择产品名称" AfterDelayDimiss:2];
            }else if(!self.heyueType){
                [self HUDShowMsg:@"请选择合约" AfterDelayDimiss:2];
            }else if(!self.guigeType){
                [self HUDShowMsg:@"请选择规格" AfterDelayDimiss:2];
            }else if(!self.areaType){
                [self HUDShowMsg:@"请选择地区" AfterDelayDimiss:2];
            }else if(!self.cangkuID){
                [self HUDShowMsg:@"请选择仓库" AfterDelayDimiss:2];
            }else if(!self.gongsiName){
                [self HUDShowMsg:@"请填写价格" AfterDelayDimiss:2];
            }else if([self.gongsiName floatValue] < 0){
                [self HUDShowMsg:@"请填写正确价格" AfterDelayDimiss:2];
            }else if(!self.dunshu){
                [self HUDShowMsg:@"请填写吨数" AfterDelayDimiss:2];
            }else if(!self.contact){
                [self HUDShowMsg:@"请填写联系人" AfterDelayDimiss:2];
            }else if(!self.phone){
                [self HUDShowMsg:@"请填写手机号" AfterDelayDimiss:2];
            }else if(self.phone.length != 11){
                [self HUDShowMsg:@"请填写正确手机号" AfterDelayDimiss:2];
            }else if(!accept){
                [self HUDShowMsg:@"同意点价协议才能发布" AfterDelayDimiss:2];
            }else{
                NSString * urlStr = @"https://dianjia.thjb.net/dingjia.php?f=Member&r=Member&m=add&act=buy";
                NSDictionary * paraDic = @{
                    @"type":self.typeStr,
                    @"num":self.dunshu,
                    @"area":self.areaType,
                    @"price":self.gongsiName,
                    @"heyueid":self.heyueType,
                    @"protype":self.guigeType,
                    @"storehouse":self.cangkuID,
                    @"contactname":self.contact,
                    @"contactmobile":self.phone,
                };
                NSLog(@"%@",paraDic);
                [THJNetWork postDataFromUrl:urlStr parameters:paraDic Token:[THJTools getToken] callback:^(NSDictionary * receiveData, NSError *error){
                    NSLog(@"receivedata:%@",receiveData);
                    [self HUDShowMsg:receiveData[@"tip"] AfterDelayDimiss:2];
                    [self performSelector:@selector(pop) withObject:nil afterDelay:2.0];
                }];
            }
            
        }
        
    }
}
#pragma mark -------edit item info ----
-(void)getItemInfo{
    NSString * url = [NSString stringWithFormat:@"%@dingjia.php?f=Member&r=Member&m=info&act=%@&id=%@",THJDJUrlDomain,self.act,self.itemid];
    NSLog(@"editinfourl-%@",url);
    [THJNetWork getNetDataWithTokenFromUrl:url callback:^(NSDictionary* receiveData, NSError *error) {
        NSLog(@"编辑iteminfo:%@",receiveData);
        if([receiveData[@"status"] isEqual:@"200"]){
            [self.productBtn setTitle:receiveData[@"data"][@"pro_name"] forState:UIControlStateNormal];
            [self.heyueBtn setTitle:receiveData[@"data"][@"heyue"] forState:UIControlStateNormal];
            [self.ggBtn setTitle:receiveData[@"data"][@"type_name"] forState:UIControlStateNormal];
            [self.areaBtn setTitle:receiveData[@"data"][@"area_name"] forState:UIControlStateNormal];
            [self.cangkuBtn setTitle:receiveData[@"data"][@"house"] forState:UIControlStateNormal];
            [self.ckAddressLabel setTitle:receiveData[@"data"][@"address"] forState:UIControlStateNormal];
            if([self.act isEqual:@"buy"]){
                self.tf1.text = receiveData[@"data"][@"price"];
            }else{
                self.stsipt.text = receiveData[@"data"][@"price"];
            }
            self.tf2.text = receiveData[@"data"][@"num"];
            
//            //服务器返回 -30 操作失败
//            [dropdownMenu.mainBtn setTitle:receiveData[@"data"][@"pro_name"] forState:UIControlStateNormal];
//            [self.areaBtn setTitle:receiveData[@"data"][@"area_name"] forState:UIControlStateNormal];
//            areaId = receiveData[@"data"][@"area"];
//            self.tf1.text = receiveData[@"data"][@"num"];
//            self.tf2.text = receiveData[@"data"][@"price"];
//            sheng = receiveData[@"data"][@"sheng"];
        }
    }];
}
- (IBAction)yanshouBianzhunBtn:(id)sender {
    [self  presentViewController:[THJDIanjiaXieYiVC new] animated:YES completion:nil];
}

- (IBAction)acceptBtnAction:(id)sender {
    if(!accept){
        [self.acceptBtn setImage:kGetImage(@"同意") forState:UIControlStateNormal];
        accept = YES;
    }else{
        [self.acceptBtn setImage:kGetImage(@"不同意") forState:UIControlStateNormal];
        accept = NO;
    }
}
@end
